from selenium.webdriver.common.by import By
from base_page import BasePage


class BaiDuNewsPage(BasePage):
    __url = "https://news.baidu.com/"
    __input = (By.CSS_SELECTOR, "#ww")
    __searchBth = (By.CSS_SELECTOR, "#s_btn_wr")

    def baidunews_page(self):
        self.driver.get(self.__url)

    def input_news(self, news):
        self.find_element(*self.__input).send_keys(news)

    def click_search_btn(self):
        self.find_element(*self.__searchBth).click()

    def search_news(self, news):
        self.baidunews_page()
        self.input_news(news)
        self.click_search_btn()
